#ifndef ENCRYPTUTILS_H
#define ENCRYPTUTILS_H

#include <string>
#include <openssl/aes.h>
#include <openssl/pem.h>
#include <openssl/rsa.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>

using namespace std;

class EncryptUtils
{
public:
    EncryptUtils();
    string EncodeRSAKeyFile( const std::string& strPemFileName, const std::string& strData );
    std::string DecodeRSAKeyFile( const std::string& strPemFileName, const std::string& strData );
    std::string EncodeAES( const std::string& password, const std::string& data );
    std::string DecodeAES( const std::string& strPassword, const std::string& strData );
    string EncodeRSAByKey( const std::string& key, const std::string& strData );
    string DecodeRSAByKey( const std::string& key, const std::string& strData );

    std::string EncodeAESCBC( const std::string& password, const std::string &iv, const std::string& data);
    std::string DecodeAESCBC( const std::string& strPassword, const std::string &iv, const std::string& strData );
};

string sha1sum(string &data);
std::string md5sum(const char *path);
#endif // ENCRYPTUTILS_H
